package com.xysl.api;


import com.xysl.api.domain.XyslUser;
import com.xysl.api.factory.RemoteXyslUserFallbackFactory;
import com.xysl.api.model.XyslLoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;

import java.util.Set;


/**
 * xysl用户服务
 *
 * @author ruoyi
 */
@FeignClient(contextId = "remoteXyslUserService", value = ServiceNameConstants.XYSL_SERVICE, fallbackFactory = RemoteXyslUserFallbackFactory.class)
public interface RemoteXyslUserService
{
    /**
     * 通过用户名查询用户信息
     *
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/user/info/{account}")
    public R<XyslLoginUser> getXyslUserInfo(@PathVariable("account") String account, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 注册用户信息
     *
     * @param xyslUser 用户信息
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/user/register")
    public R<Boolean> registerUserInfo(@RequestBody XyslUser xyslUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 记录用户登录IP地址和登录时间
     *
     * @param xyslUser 用户信息
     * @param source 请求来源
     * @return 结果
     */
    @PutMapping("/user/recordlogin")
    public R<Boolean> recordUserLogin(@RequestBody XyslUser xyslUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 用户权限信息集合
     *
     * @param xyslUser 用户信息
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/user/register")
    public R<Set<String>> getRolePermission(@RequestBody XyslUser xyslUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 用户角色信息集合
     *
     * @param xyslUser 用户信息
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/user/register")
    public R<Set<String>> getMenuwPermission(@RequestBody XyslUser xyslUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
